<template>
  <div class="container">
    <img class="login-bg" :src="background" alt="背景"/>
    <a-card class="login-card">
      <!-- 二维码 -->
      <div class="code-div">
        <a-image :width="240" shape="square" :src="picture" alt="二维码" visible="false"/>
      </div>
      <!-- 登录转换 -->
      <a-button type="link" html-type="submit" class="login-button" size="large" @click="changeLogin"> 使用账号登录 </a-button>
    </a-card>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const background = new URL('@/assets/login-bg.jpg', import.meta.url).href;

// 路由
const router = useRouter();

const picture = ref("https://tse1-mm.cn.bing.net/th/id/OIP-C.vy9vbK_uzBwa8dT9goIyCwHaHa?w=197&h=197&c=7&r=0&o=5&dpr=1.3&pid=1.7");

const changeLogin = () => {
  router.push({  name: 'Login' });
}
// // 提交表单时调用的函数。
// const onLogin = values => {
//   // 登录成功跳转路由
//   login(values).then(data => {
//     if (data.code === 0) {
//       notification.open({
//         message: '登录成功',
//         description: '欢迎您!'
//       });
//       storage.set('token', '123456');
//       router.push({ name: 'DataTable' });
//     } else {
//       notification.open({
//         message: '登录失败',
//         description: '请检查账号或密码是否正确'
//       });
//     }
//   });
// };
</script>

<style lang="less" scoped>

.container {
  display: flex;
  height: 100%;
  padding-top: 120px;
  flex-direction: column;
  align-items: center;

  .login-bg {
    position: fixed;
    top: 0;
    left: 0;
    opacity: 0.5;
    width: 100%;
    height: 100%;
  }

  .login-card {
    width: 350px;
    height: 400px;
    margin-right: -45%;
    .code-div{
      width: 250px;
      height: 250px;
      margin: 5% 8%;
      padding: 3px;
      border-style:solid;
      border-width:2px;
      border-color: rgb(217, 217, 217);
    }
  .login-button {
    margin-top: 8%;
    width: 100%;
    }
  }
}
</style>
